import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import axios from 'axios'
import utils from './utils/utils.js'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
Vue.config.productionTip = false
axios.defaults.baseURL = '/api'
Vue.prototype.axios = axios
Vue.use(ElementUI)
router.beforeEach((to, from, next) => {
  if (to.meta.isLogin) {
    //判断是否登录
    if (utils.getStorage('user')) {
      next()
    } else {
      router.push('/login')
    }
  } else {
    next()
  }
})
new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')